package controller;

import aop.LogData;
import aop.LogType;
import com.github.pagehelper.PageInfo;
import entity.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.LogService;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;

/**
 * @Author Administrator
 * @create 2020.06.21 上午 10:26
 */
@Controller
@RequestMapping("/log")
public class LogController {
    @Autowired
    private LogService logService;
//    @LogData(logType = LogType.LOGIN,description = "查看日志")
    @ResponseBody
    @RequestMapping("/list")
    public MyResult<List<Log>> layList(LayRequest layRequest){
        PageInfo<Log> rolePageInfo=logService.selectByMap(layRequest);
        return new MyResult<>(0,rolePageInfo.getTotal(),rolePageInfo.getList());
    }
    @ResponseBody
    @RequestMapping("/empty")
    public MyResult empty(){
        logService.empty();
        return new MyResult(0);
    }


}
